<script setup lang="ts">
import { provide, ref } from "vue";
import Father from "./16_跨代传值的爸爸组件.vue";
const salary = ref(10000);

// 谁提供数据 谁负责修改
provide("money", salary); // 提供给后代使用

provide("cost", (costMoney: number) => {
  salary.value -= costMoney;
});
</script>

<template>
  <h1>我是爷爷</h1>
  <p>爷爷的退休金：{{ salary }}</p>
  <Father></Father>
</template>

<style scoped></style>
